package com.lyx.controller;

import com.lyx.entity.User;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

@RestController
public class HelloController {
    @Value("${server.port}")
    private String port;

    @Value("${config.info}")
    private String info;

    @GetMapping("/hello/nacos/{id}")
    public String Hello(@PathVariable("id") Integer id){
        return "来自"+port+"端口;</br>id是"+id;
    }

    @GetMapping("/config/info")
    public String getConfigInfo(){
        return info;
    }

    @PostMapping("/hello/user")
    public String getUserInfo(@RequestBody User user){
        return "学号:"+user.getId()+"</br>姓名:"+user.getName()+"</br>来自:"+port+"端口";
    }
}
